//商品管理-商品即秒排期列表
App.util.ns('Admin.Goods.GsJmSchedule');
App.pages.add((function(){
    var NS = Admin.Goods.GsJmSchedule;
    var page = new App.Page({
        name: 'goods/gsjmschedule/index'
    });
    //页面初始化
    page.initStack.add('dataTable', function(){
        this.dataTable = new App.DataTable({
            baseUrl: '/admin/goods/gsjmschedule',
            dataUrl: 'lists',
            table: {
                id: 'id',
                main: 0,
                //showId: false,
                columns: App.util.copy(NS.Conf.columns)
            },
            filter: [
                //{type: 'keywords'},
                {type: 'timeRange'}
            ],
            menu: [
                {parent: 'add', permission: 'op:admin.goods.gsjmschedule.create'},
                //{parent: 'view', permission: 'op:admin.goods.gsjmschedule.detail'},
                {parent: 'edit', permission: 'op:admin.goods.gsjmschedule.update'},
                {parent: 'drop', permission: 'op:admin.goods.gsjmschedule.delete'},
                {parent: 'multiDrop', permission: 'op:admin.goods.gsjmschedule.multiDelete'}
            ],
            detail: {
                form: {
                    items: App.util.copy(NS.Conf.form),
                }
            },
            dragSort:{
                permission: 'op:admin.goods.gsjmschedule.sort',
                url:'sort',
                filed:'sort'
            },
        }, page);
        this.dataTable.fix(this.contentContainer);
    });
    //页面打开
    page.showStack.add('openPage', function(){
        if(this.params){
            var params = this.params;
            //设置面包屑导航
            this.setBreadcrumb([{
                icon: '<i class="fa fa-crosshairs"></i>',
                content: '商品与极秒商品排期'
            }, {
                content: '商品管理',
                action: function(){
                    App.nav.back();
                }
            }, {
                active: true,
                content: '极秒商品管理 - ' + params['schedule_name']
            }]);
            //设置参数
            for(var i in params){
                this.dataTable.param.set(i, params[i]);
            }
            if(this.dataTable.paginator){
                this.dataTable.paginator.currentPage = 1;
            }
            //加载数据
            this.dataTable.loadData();
        }
    });
    //页面刷新
    page.refreshStack.add('dataTable', function(){
        this.dataTable.loadData(true);
    });
    //页面销毁
    page.destroyStack.add('dataTable', function(){
        this.dataTable.destroy();
    });
    return page;
})());